package com.example.a4test
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.PersistableBundle
import android.util.Log
import android.view.View

class MainActivity :AppCompatActivity(){
    val TAG="MainActivity"
    override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
        super.onCreate(savedInstanceState, persistentState)
        Log.d(TAG,"onCreate")
       setContentView(R.layout.activity_main)//这个布局你得自己去建立这个东西res-layout后面，直接copy别的东西的话直接点红灯泡

    }

    override fun onStart() {
        super.onStart()
        Log.d(TAG,"onStart")
    }

    override fun onPause() {
        super.onPause()
        Log.d(TAG,"onPause")
    }

    override fun onRestart() {
        super.onRestart()
        Log.d(TAG,"onCreate")
    }

    override fun onResume() {
        super.onResume()
        Log.d(TAG,"onResume")
    }

    override fun onStop() {
        super.onStop()
        Log.d(TAG,"onStop")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(TAG,"onDestroy")

    }
    fun Click(view: View)
    {
        Log.d(TAG,"click ${view.id}")
        when(view.id){
            R.id.button->{
                val intent= Intent(this,SecondActivity::class.java)
                startActivity(intent)
            }
            R.id.button2->{

            }
        }
    }
}